var assert = require('assert');
const MarioChar1 = require('../test/shema');



describe ('update rec test',function(){
    var char1;
    beforeEach(function(done){
      char1 = new MarioChar1({
        name:'Mario',
        speed:'20',

      });
      char1.save().then(function(){
        console.log('++++++++');
        console.log(char1);
        console.log('--------')

         assert(char1.isNew === false);
         done();

      });

    });



    // it('update one rec ',function(done){
    //   MarioChar1.findOneAndUpdate({name:'Mario'},{name:'Luigi'}).then(function(d){
    //     MarioChar1.findOne({name:'Luigi'}).then(function(d){
    //     console.log(d);
    //     assert(d.name === 'Luigi');
    //     done();})
    //
    //   })

      it('update all rec ',function(done){
        MarioChar1.update({},{$inc:{speed:1}}).then(function(d){
          MarioChar1.findOne({name:'Mario'}).then(function(d){
          console.log(d);
          assert(d.name === 'Mario');
          done();})

        })

    });





});
